/*
 * @Author: CPS
 * @Date: 2020-07-14 11:52:19
 * @Last Modified by: CPS
 * @Last Modified time: 2020-07-30 12:13:39
 * @Projectname Electron-YYS
 * @Filename main.event.js
 */
'use strict'
console.log('loading main.event.js')

// 绑定事件
ipcMain.on('before-bind', function(e) {
  console.log('创建一个前置提示框')
  // createSonWindow(width, height, htmlf)
  e.sender.send('bind')
})

// 打开文件对话框
ipcMain.on('openFloder', (e, args) => {
  console.log('接收到数据：' + args)
  let res = dialog.showOpenDialog(args)
    .then(res => {
      if (!res.canceled) { //判断如果选择了取消，则不执行
        e.reply('changePreImg', res.filePaths); //给渲染进程回传结果  - 异步
      }
    });
});

ipcMain.on('createSonWindow', (e, options) => {
  console.log('接收到创建子窗口事件')

})


module.exports = {
  mainConfig: 'mainConfig'
}